﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using QLXuongCNTT.Object;
using QLXuongCNTT.DataLayers;
namespace QLXuongCNTT.ControlLayers
{
    class ctrlGiaovien
    {
        dtlGiaovien dtGV;
        DataTable tbGV;
        
        string error;
        objGiaovien giaovien;

        internal objGiaovien Giaovien
        {
            get { return giaovien; }
            set { giaovien = value; }
        }
        public string Error
        {
            get { return error; }
            set { error = value; }
        }
        public ctrlGiaovien()
        {
            dtGV = new dtlGiaovien();
            giaovien = new objGiaovien();
            error = "";
        }
        public DataTable getGiaovien()
        {
            tbGV = dtGV.GetGiaovien();
            if (!dtGV.Error.Equals(""))
                error = dtGV.Error;
            return tbGV;
        }
        public void AddGiaovien()
        {
            DataRow row = dtGV.NewRow();
            row["MaGV"] = giaovien.Magv;
            row["TenGV"] = giaovien.Tengv;
            row["Mato"] = giaovien.Mato;
            dtGV.Addrow(row);
        }
        public bool save()
        {
            return dtGV.Save();
        }
        
    }
}
